@isTest
private class NewAccountShareTest{
  
  static testMethod void testNewAccountShare(){
    Set<Id> AcId = New Set<Id>();
    list<AccountShare> ASlist = new list<AccountShare>();
    list<AccountShare> ASlist1 = new list<AccountShare>();
    list<AccountTeamMember> ATeam = new list<AccountTeamMember>();
    list<ID> ATeam1 = new list<Id>();
    list<Purchase_Object__Share> POSlist = new list<Purchase_Object__Share>();
    list<Purchase_Object__Share> POSlist1 = [select id,parentid,USERORGROUPID from Purchase_Object__Share];
    list<Purchase_Object__Share> POSlistdel = new list<Purchase_Object__Share>();
    list<Account> acclist = new list<Account>();
    list<Account> ATlist = new list<Account>();
    Set<ID> poi = New set<Id>();
    list<Purchase_Object__c> poli = New list<Purchase_Object__c>();
   Account Acc = New Account();
    Acc.Name = 'Test Account';
    Acc.Oracle_Account_Number__c = 1254545;
    Acc.Organisation_Number__c  = 545474;
    Acc.OwnerId = '00590000000c1wF';
    insert Acc;
   Purchase_Object__c pob = new Purchase_Object__c();
         pob.Name = 'Test PO';   
         pob.Oracle_Acc_Number__c = 1254545;    
         pob.Account__c = Acc.Id;         
       if(pob.Oracle_Acc_Number__c == Acc.Oracle_Account_Number__c){  
          pob.OwnerId = Acc.OwnerId;
          }
       poi.add(pob.id);      
   insert pob;
   AcId.add(pob.Account__c);
   AccountTeamMember Atmem = New AccountTeamMember();
    
    Atmem.AccountId = Acc.Id;
    Atmem.UserId = '00590000000c4JK';
    insert Atmem;
    
    AccountShare Ash = New AccountShare();
     Ash.USERORGROUPID = '00590000001EQTx';
     Ash.ACCOUNTACCESSLEVEL = 'Edit';
     Ash.OpportunityAccessLevel = 'Edit';
     Ash.AccountId = Acc.Id;
   Insert Ash;
      
   Purchase_Object__Share posh = New Purchase_Object__Share();
   if(pob.Account__c == ash.ACCOUNTID && ash.USERORGROUPID!=pob.Ownerid){
     posh.ACCESSLEVEL= 'read';
     posh.PARENTID= pob.id;
     posh.USERORGROUPID= ash.USERORGROUPID;
    }
   insert posh;
   delete posh; 
   
    }
  }